import dayjs from 'dayjs'

export function formatMonthDay(date, format = "MM月DD日") {
  return dayjs(date).format(format)
}

export function getDiffDays(startDate, endDate) {
  return dayjs(endDate).diff(startDate, "day")
}

export function formatMonthWeek(dateString, isWeek = false) {
  let date = new Date(dateString)
  if (isWeek) {
    return "周" + "日一二三四五六".charAt(date.getDay())
  }

  return `${date.getMonth() + 1}月${date.getDate()}日`
}